home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 September / GSSH0904CD1.iso / RiseofNations / RedFront / RedFront.exe / Red Front / Red Front - 04 - Moscow.bhs < prev    next >
Text File  |  2004-02-15  |  62KB  |  2,069 lines

  1. /* Red Front
  2.    Moscow
  3.    
  4.    These events will control the Moscow scenario for the Red Front campaign.
  5.   
  6.    Campaign By: Kevin 'DarthVeda' Chulski
  7.    Contact: darthveda@hotmail.com
  8.    Please email any questions/suggestions/comments that you have!   
  9. */
  10.  
  11. scenario
  12. {
  13.  
  14.   set_nation_name("Russians", $S("Red Army"));
  15.   set_nation_name("Romans", $S("Germans"));
  16.   
  17.   // initialize variables
  18.   static int month = 10;
  19.   static int day = 1;
  20.   static int num_citizens = 0;
  21.   static int sibir_announce = 0;
  22.   static int tempOwner = 0;
  23.   static int MOSCOW_ID = find_city_id( "Moscow" );  // Prevent player from changing names to mess with script
  24.   static int GER_BOOST_INTERVAL = 180; // controls german resource boost (in seconds)
  25.   static int KREM_BOOST = 0; // Additional Boost from Kremlin
  26.   static int vicCounter = 0;
  27.   
  28.   // Things dealing with loafing (idle units)
  29.   // Teams that idle too much will have their units automatically directed
  30.   // This is to prevent AI opponents from having piles of unused units.
  31.   // A loaf count of BOOT_THRESHOLD or more will trigger the event.
  32.   static int LOAF_INTERVAL = 30; // Number of second between loaf checks
  33.   static int LOAF_THRESHOLD = 10; // minimum number of idle military units to be considered loafing
  34.   static int BOOT_THRESHOLD = 10; // minimum loaf count to have units automatically controlle
  35.   static int idle_units = 0;
  36.   static int loaf_count_5 = 0;
  37.   static int loaf_count_6 = 0;
  38.   
  39.   // Things dealing with random attack
  40.   static int X = 0;
  41.   static int Y = 0;
  42.   static int X2 = 0;
  43.   static int Y2 = 0;
  44.   static int spawn = 0;
  45.   static int point = 0;
  46.   static int spawn_who = 0;
  47.   
  48.   // Get certain city IDs
  49.   static int KALININ_ID = find_city_id( "Kalinin" );
  50.   static int KALUGA_ID = find_city_id( "Kaluga" );
  51.   static int MOZHAISK_ID = find_city_id( "Mozhaisk" );
  52.   static int VOLOKOLAMSK_ID = find_city_id( "Volokolamsk" );
  53.   static int KLIN_ID = find_city_id( "Klin" );
  54.   static int ISTRA_ID = find_city_id( "Istra" );
  55.   static int TULA_ID = find_city_id( "Tula" );
  56.     
  57. labels {
  58.   //Add any constant labels here in a comma separated list.
  59.   
  60. }
  61.  
  62. run_once {
  63.   //Insert commands that should be executed only once when the script is loaded here.
  64.   
  65.   //disable weird things
  66.   
  67.   disable_type("Helicopter");
  68.   disable_type("Nuclear Missile");
  69.   disable_type("Missile Silo");
  70.   disable_type("Spy");
  71.   
  72.   set_music_mood("losing", true);
  73.   
  74.   // disable wonders
  75.   
  76.   disable_type( "Pyramids" );
  77.   disable_type( "Colossus" );
  78.   disable_type( "Terra Cotta Army" );
  79.   disable_type( "Colosseum" );
  80.   disable_type( "Temple of Tikal" );
  81.   disable_type( "Porcelain Tower" );
  82.   disable_type( "Angkor Wat" );
  83.   disable_type( "Versailles" );
  84.   disable_type( "Statue of Liberty" );
  85.   disable_type( "Kremlin" );
  86.   disable_type( "Taj Mahal" );
  87.   disable_type( "Eiffel Tower" );
  88.   disable_type( "Supercollider" );
  89.   disable_type( "Space Program" );
  90.   
  91.   // disable certain buildings and guys
  92.   
  93.   disable_type( "Fishermen" );
  94.   disable_type( "Small City" );
  95.   
  96.   // disable ships
  97.   
  98.   //Gain Upgrades
  99.   set_population_cap(5,250);
  100.   set_population_cap(6,250);
  101.   
  102.   // set timers
  103.   set_timer( "cdar", 60 );
  104.   set_timer( "siberia", 60 );
  105.   set_timer( "greboost", GER_BOOST_INTERVAL );
  106.   set_timer( "loafCheck", LOAF_INTERVAL );
  107.     
  108.   // disable triggers
  109.   
  110.   disable_trigger ( "rboost" );
  111.   disable_trigger ( "eliminator" );
  112.   disable_trigger ( "lendlease" );
  113.   disable_trigger ( "keep_pop_cap_low" );
  114.   disable_trigger ( "i_r_winner" );
  115.   disable_trigger ( "kamikaze" );
  116.   
  117.   // blurb or cinematic
  118.   
  119.     
  120. }
  121.  
  122. //Main script body.
  123. //Add triggers and other commands to be executed each game frame here.
  124. //Use Edit->Insert Trigger Function to select from the list of available functions
  125. //Use Edit->Insert Trigger Block to add a blank trigger block.
  126. //See ./scenario/sample_script.bhs for additional documentation
  127.  
  128.  trigger opening_scene ( )
  129.   {
  130.     set_msg_time(20);//Sets message time to 30 seconds
  131.     scrolling_lock();//Locks scrolling
  132.     zooming_lock();//Locks zooming
  133.     hotkey_selection_disable();//disables hotkey selection
  134.     ui_hide();//Hides the UI
  135.     mouse_selection_disable();//disables mouse selection
  136.     print_msg("October, 1941 - The German armies have begun their final assault on the capital of the Soviet Union: Moscow.  Defenses ring the city, but the Russian Army will still be hard-pressed to stop the German onslaught." ); 
  137.     set_timer( "opener", 20 );
  138.   }
  139.  
  140.   trigger clear_intro ( timer_expired( "opener" ) ) 
  141.   {
  142.     move_camera(23,21);//Moves camera from action scene
  143.     set_msg_time(6);//Resets message time to default
  144.     clear_msg();//clears text
  145.     scrolling_unlock();
  146.     zooming_unlock();
  147.     hotkey_selection_enable();
  148.     mouse_selection_enable();
  149.     ui_show();
  150.     set_timer( "ra_one", 60 );
  151.     set_timer( "ra_two", 90 );
  152.     set_timer( "ra_three", 120 );
  153.     add_objective_text( "Date: October 1, 1941", "date", "null.wav" );
  154.     popup_dialog( "Comrade General, some defenses have already been prepared, but more is necessary.  Firstly, we will need to improve our fighting technology." );
  155.     popup_dialog( "NEW OBJECTIVE: Advance to Modern Age" );
  156.     add_objective( "Advance to Modern Age", "advancement", "null.wav" );
  157.     popup_dialog( "Additionally general, the Kremlin has sustained bomb damage in a recent air raid.  Repair the damage." );
  158.     popup_dialog( "NEW OPTIONAL OBJECTIVE: Finish Kremlin construction" );
  159.     add_objective( "Optional: Finish Kremlin construction", "kremlin", "null.wav" );
  160.     popup_dialog( "And General, do not let Moscow fall." );
  161.     popup_dialog( "NEW OBJECTIVE: Defend Moscow" );
  162.     add_objective( "Defend Moscow", "moskva", "null.wav" );
  163.   }
  164.   
  165.   trigger calendar ( timer_expired( "cdar" ) )
  166.   {
  167.     // check for month change
  168.     if ( ( day == 30 && month == 11) || ( day == 31 && month == 10 ) )
  169.     {
  170.       if ( month == 10 )
  171.       {
  172.       month = 11;
  173.       day = 1;
  174.       }
  175.       else
  176.       {
  177.       // it's november, so change to december
  178.       month = 12;
  179.       day = 1;
  180.       }
  181.     }
  182.     else if ( day == 31 && month == 12 )
  183.     {
  184.       // its the end of the year, change to January
  185.       day = 1;
  186.       month = 1;
  187.     }
  188.     else if ( day == 31 && month == 1 )
  189.     {
  190.       // its the end of the scenario and the player is not yet done
  191.       popup_dialog( "Comrade general, your ineptitude in driving the Germans from Moscow will show deeply on your future military career.  That is, if you have one.  Comrade Stalin has already approved your replacement, General.  Your defeat will be his burden as the spring approaches.  You are dismissed." );
  192.       defeat( 1 );
  193.     }
  194.     else
  195.     {
  196.       // no month change, normal increment
  197.       day++;
  198.     }
  199.     
  200.     if ( month == 10 )
  201.     {
  202.       change_objective_text( "date" , "Date: October " +day+", 1941" );
  203.     }
  204.     else if ( month == 11 )
  205.     {
  206.       change_objective_text( "date", "Date: November " +day+", 1941" );
  207.     }
  208.     else if ( month == 12 )
  209.     {
  210.       change_objective_text( "date", "Date: December " +day+", 1941" );
  211.     }
  212.     else if ( month == 1 )
  213.     {
  214.       change_objective_text( "date", "Date: January " +day+", 1942" );
  215.     }  
  216.     
  217.     set_timer( "cdar", 60 );
  218.     enable_trigger( "calendar" );
  219.   } // end of calendar trigger
  220.   
  221.   trigger rzhev_breaks ( month == 10 && day == 6 )
  222.   {
  223.     create_unit(6,223,395,"Infantry",8);
  224.     group_attack_to_order(6,216,362);
  225.     create_unit(6,223,395,"Tank",4);
  226.     group_attack_to_order(6,216,362);
  227.     create_unit(6,223,395,"Heavy Machine Gun",2);
  228.     group_attack_to_order(6,216,362);
  229.     create_unit(6,223,395,"Armored Scout Car",2);
  230.     group_attack_to_order(6,216,362);
  231.     create_unit(6,223,395,"Howitzer",2);
  232.     group_attack_to_order(6,216,362);
  233.     create_unit(6,223,395,"Supply Wagon",2);
  234.     group_attack_to_order(6,216,362);
  235.   }
  236.   
  237.   trigger viaz_breaks ( month == 10 && day == 6 )
  238.   {
  239.     // outta my way
  240.     destroy_building(4,2013);
  241.     destroy_building(4,2014);
  242.   
  243.     create_unit(5,351,296,"Infantry",8);
  244.     group_attack_to_order(5,303,303);
  245.     create_unit(5,351,296,"Tank",4);
  246.     group_attack_to_order(5,303,303);
  247.     create_unit(5,351,296,"Heavy Machine Gun",2);
  248.     group_attack_to_order(5,303,303);
  249.     create_unit(5,351,296,"Armored Scout Car",2);
  250.     group_attack_to_order(5,303,303);
  251.     create_unit(5,351,296,"Howitzer",2);
  252.     group_attack_to_order(5,303,303);
  253.     create_unit(5,351,296,"Supply Wagon",2);
  254.     group_attack_to_order(5,303,303);  
  255.   }
  256.   
  257.   trigger the_panic ( month == 10 && day == 16 )
  258.   {
  259.     popup_dialog("October 16 - Chaos ensues in Moscow as alarmed citizens realize the seriousness of the German assault towards Moscow.  Many flee the city rather than stay and fight as they believe the Germans will enter Moscow tomorrow.  General, prepare to lose many civilian workers!" );
  260.     num_citizens = num_type(1,"Citizen");
  261.     set_timer( "yournumberisup", (int) (120 / num_citizens) );
  262.     enable_trigger( "eliminator" );
  263.   }
  264.   
  265.   trigger eliminator ( timer_expired( "yournumberisup" ) )
  266.   {
  267.     kill_unit_anim( 1, find_unit( 1, "Citizen" ), 1 );
  268.     set_timer ( "yournumberisup", (int) (120 / num_citizens) );
  269.     enable_trigger( "eliminator" );
  270.   }
  271.   
  272.   trigger stalin_speaks ( month == 10 && day == 17 )
  273.   {
  274.     disable_trigger( "eliminator" );
  275.     popup_dialog("October 17 - Stalin speaks on the radio to the public of Moscow.  He denies rumors of imminent surrender and states that \"Every one of us, no matter what his work or his position, shall act like a soldier defending Moscow against the Fascist invaders.\"  The speech has the affect of calming the panic." );
  276.   }
  277.   
  278.   trigger stalin_speaks_again ( month == 11 && day == 6 )
  279.   {
  280.     popup_dialog("November 6 - Stalin gives a speech on the evenening of the anniversary of the 1917 revolution.  He states that the German army has suffered great setbacks and that there would be \"no mercy for the German invaders.\"  He concludes with \"Long live our Red Army and our Red Navy!  Long Live our glorious country!  Our cause is just.  Victory will be ours!\"" );
  281.     popup_dialog("Additionally, the United States has granted the Soviet Union a one-billion dollar loan on this day.  Comrade general, we can expect a boost to our wealth as a result.");
  282.     set_timer( "lend", 1 );
  283.     enable_trigger( "lendlease" );
  284.   }
  285.   
  286.   trigger end_of_first_offensive ( month == 10 && day == 31 )
  287.   {
  288.     popup_dialog( "General, our front line divisions report a drop-off in German activity.  It is suspected that German divisions are gathering strength for a last push against Moscow." );
  289.     disable_trigger( "grboost" );
  290.     disable_trigger( "random_attack_1" );
  291.     disable_trigger( "random_attack_2" );
  292.     disable_trigger( "random_attack_3" );
  293.     disable_trigger( "loafer_detector" );
  294.   }
  295.   
  296.   trigger german_second_offensive ( month == 11 && day == 14 )
  297.   {
  298.     enable_trigger( "grboost" );
  299.     set_timer( "greboost", 1);
  300.     enable_trigger( "random_attack_1" );
  301.     enable_trigger( "random_attack_2" );
  302.     enable_trigger( "random_attack_3" );
  303.     enable_trigger( "loafer_detector" );
  304.     enable_trigger( "kamikaze" );
  305.     set_timer( "loafCheck", LOAF_INTERVAL );
  306.     set_timer( "ra_one", 1);
  307.     set_timer( "ra_two", 30);
  308.     set_timer( "ra_three", 45);
  309.   }
  310.   
  311.   trigger german_second_scouts ( month == 11 && day == 15 )
  312.   {
  313.     popup_dialog ( "Scouts report that the Germans have renewed their push against Moscow.  Be prepared, comrade general." );
  314.   }
  315.     
  316.   trigger push_on_tula ( month == 11 && day == 16 )
  317.   {
  318.     // outta my way
  319.     destroy_building(2,2010);
  320.     destroy_building(2,2011);
  321.     
  322.     create_unit(5,374,119,"Infantry",10);
  323.     group_attack_to_order(5,330,88);
  324.     create_unit(5,374,119,"Tank",6);
  325.     group_attack_to_order(5,330,88);
  326.     create_unit(5,374,119,"Heavy Machine Gun",2);
  327.     group_attack_to_order(5,330,88);
  328.     create_unit(5,374,119,"Armored Scout Car",2);
  329.     group_attack_to_order(5,330,88);
  330.     create_unit(5,374,119,"Howitzer",3);
  331.     group_attack_to_order(5,330,88);
  332.     create_unit(5,374,119,"Supply Wagon",2);
  333.     group_attack_to_order(5,330,88);      
  334.   }
  335.   
  336.   trigger end_of_german_attack ( month == 12 && day == 5 )
  337.   {
  338.     disable_trigger( "grboost" );
  339.     disable_trigger( "random_attack_1" );
  340.     disable_trigger( "random_attack_2" );
  341.     disable_trigger( "random_attack_3" );
  342.     disable_trigger( "highcap" );
  343.     popup_dialog( "Bogged down by an immense long supply line and terrible roads, but most of all General Winter, the German offensive has finally halted.  German soldiers all over the front find themselves freezing to death in ditches and clinging to frozen weapons.  Comrade general, this is the perfect time for our counter-offensive!  Drive the Germans from Moscow general, and do so by the end of January." );
  344.     objective_complete( "moskva" );
  345.     
  346.     set_population_cap(5,180);
  347.     set_population_cap(6,180);
  348.     set_population_cap(1,300);
  349.     enable_trigger( "keep_pop_cap_low" );
  350.     enable_trigger( "i_r_winner" );
  351.     set_timer( "hurtthem", 5 );
  352.     
  353.     KREM_BOOST = 15;
  354.     popup_dialog( "NEW OBJECTIVE: Push Germans of the map" );
  355.     add_objective( "Push Germans off the map", "offensive", "null.wav" );
  356.     
  357.   }
  358.   
  359.   trigger pearl_harbor ( month == 12 && day == 8 )
  360.   {
  361.     popup_dialog("General, word has arrived that the American Pacific fleet at anchor in Pearl Harbor has been devastated by Japanese Attack.  America is now at war with Japan.  We will keep you informed of further developments, comrade general." );
  362.   }
  363.   
  364.   trigger germany_against_the_eagle ( month == 12 && day == 11 )
  365.   {
  366.     popup_dialog("Excellent news comrade general:  The Germans have foolishly declared war on the Americans in a show of solidarity with their Japanese \"Allies.\"  This is a huge windfall General, and Comrade Stalin has high hopes that a second front in Europe may be imminent." );
  367.   }
  368.   
  369.   trigger sibera_stop ( month == 12 && day == 15 )
  370.   {
  371.     popup_dialog( "Sir, all of the reinforcements from Siberia have arrived.  However, conscripts from other parts of Russia will continue to pour in." );
  372.   }
  373.   
  374.   trigger last_days_warning ( month == 1 && day == 26 )
  375.   {
  376.     popup_dialog("Stalin has sent you a message general.  It states that you are to immediately seize the remaining German positions around Moscow.  Failure will not be tolerated.  Make haste, comrade general." );
  377.   }
  378.   
  379.   trigger highcap ( )
  380.   {
  381.     set_population_cap(5,250);
  382.     set_population_cap(6,250);
  383.     enable_trigger( "highcap" );
  384.   }
  385.   
  386.   trigger lendlease ( timer_expired( "lend" ) )
  387.   {
  388.     give_good( 1, "wealth", 100 );
  389.     set_timer( "lend", 60 );
  390.     enable_trigger( "lendlease" );
  391.   }
  392.   
  393.   trigger keep_pop_cap_low ( timer_expired( "hurtthem" ) )
  394.   {
  395.     set_population_cap(1,300);
  396.     set_population_cap(5,120);
  397.     set_population_cap(6,120);
  398.     /* If more drastic measures are necessary
  399.     while( population( 5 ) > 120 )
  400.     {
  401.       kill_unit( 5, find_military(5) );
  402.     }
  403.     while( population( 6 ) > 120 )
  404.     {
  405.       kill_unit( 6, find_military(6) );
  406.     }
  407.     */
  408.     set_timer( "hurtthem", 5 );
  409.     enable_trigger( "keep_pop_cap_low" );
  410.   }
  411.   
  412.   trigger krem_built ( get_wonder_points( 1 ) > 0 )
  413.   {
  414.     popup_dialog( "Good job, comrade general.  The leadership provided by the Kremlin will give us a resource boost by improving supply into the city.  Additionally, the Germans will now feel attrition at a higher rate." );
  415.     objective_complete( "kremlin" );
  416.     enable_trigger( "rboost" );
  417.     set_timer( "reboost", 1 );
  418.   }
  419.   
  420.   trigger krem_destroyed ( building_type_destroyed( 1,"Kremlin") )
  421.   {
  422.     popup_dialog( "This is horribile.  Without the Kremlin our armies will be leaderless and at the mercy of the Germans.  You have almost certainly doomed us all, general." );
  423.     set_population_cap(1,50);
  424.     remove_objective( "kremlin" );
  425.     disable_trigger( "rboost" );
  426.     disable_trigger( "sibir" );
  427.   }
  428.   
  429.   trigger moscow_cap ( city_id_captured( 1, MOSCOW_ID ) )
  430.   {
  431.     popup_dialog( "General, you have disgraced yourself and quite possibly the war is lost on your account.  Perhaps it is fortunate that you have been captured by the Germans rather than having to bear defeat in front of comrade Stalin." );
  432.     defeat( 1 );
  433.   }
  434.   
  435.   trigger advances_made ( at_least_age(1,6) )
  436.   {
  437.     popup_dialog( "With our advancement into a new age of warfare, our troops will be better equipped to face the German attackers.  Additionally, we now have Red Guards at our command.  These elite troops are made up of veterans from summer combat and will fight better than normal Riflemen." );
  438.     objective_complete( "advancement" );
  439.     gain_tech(1, "Nation-in-Arms" );
  440.     if ( gain_upgrade( 1,"Red Guards Infantry" ) == -1 )
  441.     {
  442.       print_game_msg( "Error: Failed to upgrade from Riflemen" );
  443.     }
  444.   }
  445.   
  446.   trigger tula_cap ( city_assimilate( 5, "Tula" ) ||  city_assimilate( 5, "Tula" ) )
  447.   {
  448.     tempOwner = find_city_owner( "Tula" );
  449.     create_building( tempOwner, 275, 38, "Airbase" );
  450.     disable_trigger( "push_on_tula" );  // no sense in capturing it twice
  451.   }
  452.   
  453.   trigger sibir ( timer_expired( "siberia" ) )
  454.   {
  455.     // siberian reinforcement trigger
  456.     ping(1,1,72,5);
  457.     if ( ( ( month == 12 ) && ( day > 15 ) ) || ( month == 1 ) )
  458.     {
  459.       create_unit(1,72,5,"Riflemen",4);
  460.       group_move_order(1,119,37);    
  461.     }
  462.     else
  463.     {
  464.       create_unit(1,72,5,"Shock Infantry",3);
  465.       group_move_order(1,119,37);
  466.     }
  467.     create_unit(1,72,5,"Heavy Machine Gun",1);
  468.     group_move_order(1,119,37);
  469.     create_unit(1,72,5,"Tank",1);
  470.     group_move_order(1,119,37);
  471.     if ( KREM_BOOST > 0 )
  472.     {
  473.       create_unit(1,72,5,"Riflemen",2);
  474.       group_move_order(1,119,37);
  475.       create_unit(1,72,5,"Tank",1);
  476.       group_move_order(1,119,37);
  477.       create_unit(1,72,5,"Katyusha Rocket",1);
  478.       group_move_order(1,119,37);
  479.     }
  480.  
  481.     if ( !sibir_announce )
  482.     {
  483.       move_camera(72,5);
  484.       popup_dialog( "The first of the reinforcements from Siberia have arrived, comrade general.  They are well trained and equipped.  We should put them to good use immediately." );
  485.       sibir_announce = 1;
  486.     }
  487.  
  488.     rand_seed( score(1) );
  489.     set_timer( "siberia", 60 + rand_int(0,30) );
  490.     enable_trigger( "sibir" );
  491.   }
  492.   
  493.   trigger rboost ( timer_expired( "reboost" ) )
  494.   {
  495.     // Kremlin resource trigger
  496.     give_good(1,"food",15+KREM_BOOST);
  497.     give_good(1,"timber",15+KREM_BOOST);
  498.     give_good(1,"metal",10+KREM_BOOST);
  499.     give_good(1,"oil",10+KREM_BOOST);
  500.     give_good(1,"wealth",10+KREM_BOOST);
  501.     give_good(1,"knowledge",5);
  502.     
  503.     set_timer( "reboost", 15 );
  504.     enable_trigger( "rboost" );
  505.   }
  506.   
  507.   trigger grboost ( timer_expired( "greboost" ) )
  508.   {
  509.     set_good(5,"food",5000);
  510.     set_good(5,"timber",5000);
  511.     set_good(5,"metal",5000);
  512.     set_good(5,"oil",5000);
  513.     set_good(5,"wealth",5000);
  514.     
  515.     set_good(6,"food",5000);
  516.     set_good(6,"timber",5000);
  517.     set_good(6,"metal",5000);
  518.     set_good(6,"oil",5000);
  519.     set_good(6,"wealth",5000);
  520.     
  521.     set_timer( "greboost", GER_BOOST_INTERVAL );
  522.     enable_trigger( "grboost" );
  523.   }
  524.   
  525.   trigger rz_hedgehog ( city_assimilate(5,"Rzhev") || city_assimilate(6,"Rzhev") )
  526.   {
  527.     tempOwner = find_city_owner( "Rzhev" );
  528.     create_building(tempOwner,190,355,"Redoubt");
  529.     create_building(tempOwner,191,327,"Redoubt");
  530.     create_building(tempOwner,238,351,"Redoubt");
  531.     create_building(tempOwner,216,350,"Bunker");
  532.     create_building(tempOwner,203,353,"Bunker");
  533.     create_building(tempOwner,211,333,"Bunker");
  534.     create_building(tempOwner,205,330,"Airbase");
  535.     create_building(tempOwner,214,352,"Radar Air Defense");
  536.   }
  537.   
  538.   trigger vz_hedgehog ( city_assimilate(5,"Viazma") || city_assimilate(6,"Viazma") )
  539.   {
  540.     tempOwner = find_city_owner( "Viazma" );
  541.     create_building(tempOwner,262,290,"Redoubt");
  542.     create_building(tempOwner,277,277,"Redoubt");
  543.     create_building(tempOwner,310,279,"Redoubt");
  544.     create_building(tempOwner,277,290,"Bunker");
  545.     create_building(tempOwner,290,286,"Bunker");
  546.     create_building(tempOwner,270,302,"Bunker");
  547.     create_building(tempOwner,295,302,"Radar Air Defense");
  548.   }
  549.   
  550.   trigger gz_hedgehog ( city_assimilate(5,"Gzhatsk") || city_assimilate(6,"Gzhatsk") )
  551.   {
  552.     tempOwner = find_city_owner( "Gzhatsk" );
  553.     create_building(tempOwner,209,301,"Redoubt");
  554.     create_building(tempOwner,215,279,"Redoubt");
  555.     create_building(tempOwner,238,264,"Redoubt");
  556.     create_building(tempOwner,233,293,"Bunker");
  557.     create_building(tempOwner,230,309,"Bunker");
  558.     create_building(tempOwner,239,339,"Bunker");
  559.     create_building(tempOwner,217,288,"Radar Air Defense");    
  560.   }
  561.   
  562.   trigger loafer_detector ( timer_expired( "loafCheck" ) )
  563.   {
  564.     // loafer_detector examines how many idle military units are 
  565.     // under an AI's control.  If it is greater than 10, then something is done.
  566.     
  567.     // The reasoning behind this, is that often one or more AI opponents likes
  568.     // to just pile their units in one spot and never do anything.  This can get
  569.     // very boring waiting for the AI to do something.
  570.   
  571.    // reset variables
  572.     idle_units = 0;
  573.   
  574.     // Check player five
  575.   
  576.     for ( int i = 0; i < num_units( 5 ); i++ )
  577.     {
  578.       idle_units = idle_units + find_idle_military( 5 );
  579.     }
  580.     
  581.     if ( idle_units >= LOAF_THRESHOLD )
  582.     {
  583.       // Add to the loaf count.  10 units loafing would be +1, 20 would be +2, etc.
  584.       loaf_count_5 = loaf_count_5 + (int) ( idle_units / 10 );
  585.     }
  586.     else
  587.     {
  588.       // Less than 10 loafers.
  589.       if ( loaf_count_5 > 0 )
  590.       {
  591.         loaf_count_5--; // subtract one from the loaf count for being a good AI
  592.       } 
  593.     }
  594.     idle_units = 0; // You should always clean up after yourself
  595.     
  596.   
  597.     // Check player six
  598.     
  599.     for ( int j = 0; j < num_units( 6 ); j++ ) 
  600.     {
  601.       idle_units = idle_units + find_idle_military( 6 );
  602.     }
  603.  
  604.     if ( idle_units >= LOAF_THRESHOLD )
  605.     {
  606.       // Add to the loaf count.  10 units loafing would be +1, 20 would be +2, etc.
  607.       loaf_count_6 = loaf_count_6 + (int) ( idle_units / 10 );
  608.     }
  609.     else
  610.     {
  611.       // Less than 10 loafers.
  612.       if ( loaf_count_6 > 0 )
  613.       {
  614.         loaf_count_6--; // subtract one from the loaf count for being a good AI
  615.       }
  616.     }
  617.     idle_units = 0; // You should always clean up after yourself
  618.     
  619.   
  620.     set_timer( "loafCheck", LOAF_INTERVAL );
  621.     enable_trigger( "loafer_detector" );
  622.   }
  623.   
  624.   trigger no_loafing ( ( loaf_count_5 >= BOOT_THRESHOLD ) || ( loaf_count_6 >= BOOT_THRESHOLD ) )
  625.   {
  626.     // This trigger gets all those loafers back to the attack
  627.   
  628.     int loafer_id = 0; // id of loafing unit
  629.     int X3 = 0; // X3, Y3 are the attack address
  630.     int Y3 = 0;
  631.     
  632.     // Figure out where to go
  633.     if ( ( find_city_owner( "Rzhev" ) != 5 ) && ( find_city_owner( "Rzhev" ) != 6 ) )
  634.     {
  635.       X3 = 199;
  636.       Y3 = 343;
  637.     }
  638.     else if ( ( find_city_owner( "Viazma" ) != 5 ) && ( find_city_owner( "Viazma" ) != 6 ) )
  639.     {
  640.       X3 = 282;
  641.       Y3 = 293;
  642.     }
  643.     else if ( ( find_city_owner( "Gzhatsk" ) != 5 ) && ( find_city_owner( "Gzhatsk" ) != 6 ) )
  644.     {
  645.       X3 = 232;
  646.       Y3 = 293;
  647.     }
  648.     else if ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) )
  649.     {
  650.       X3 = 48;
  651.       Y3 = 258;
  652.     }
  653.     else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  654.     {
  655.       X3 = 99;
  656.       Y3 = 215;
  657.     }
  658.     else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  659.     {
  660.       X3 = 147;
  661.       Y3 = 158;
  662.     }
  663.     else if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  664.     {
  665.       X3 = 224;
  666.       Y3 = 114;
  667.     }
  668.     else if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  669.     {
  670.       X3 = 35;
  671.       Y3 = 186;
  672.     }
  673.     else if ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) )
  674.     {
  675.       X3 = 300;
  676.       Y3 = 61;
  677.     }
  678.     else if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  679.     {
  680.       X3 = 88;
  681.       Y3 = 128;
  682.     }
  683.     else
  684.     {
  685.       // Go to Moscow
  686.       X3 = 27;
  687.       Y3 = 26;
  688.     }
  689.     
  690.     // unloaf player 5  
  691.     if ( loaf_count_5 >= BOOT_THRESHOLD )
  692.     {
  693.       for ( int k = 0; k < num_military_units( 5 ); k++ )
  694.       {
  695.         loafer_id = find_idle_military( 5 );
  696.         unit_attack_to_order( 5, loafer_id, X3, Y3);
  697.       }
  698.       
  699.       loaf_count_5 = 0;  // loafers cleaned out
  700.     }
  701.     
  702.     // unloaf player 6
  703.     if ( loaf_count_6 >= BOOT_THRESHOLD)
  704.     {
  705.       for ( int l = 0; l < num_military_units( 6 ); l++ )
  706.       {
  707.         loafer_id = find_idle_military( 6 );
  708.         unit_attack_to_order( 6, loafer_id, X3, Y3);
  709.       }
  710.       
  711.       loaf_count_6 = 0;  // loafers cleaned out
  712.     }
  713.   
  714.     enable_trigger( "no_loafing" );
  715.   }
  716.   
  717.   trigger random_attack_1 ( timer_expired( "ra_one" ) && !( is_defeated(5) || is_defeated(6) ) )
  718.   {
  719.     // reset variables
  720.     X = 0;
  721.     Y = 0;
  722.     point = 0;
  723.     spawn_who = 0;
  724.     
  725.     // Get spawn
  726.     // This while loop wil continue looping until a spawn point has been set
  727.     // It will only select cities if those cities are owned by the Germans
  728.     rand_seed( score ( 1 ) );
  729.     while ( ( X == 0 ) && ( Y == 0 ) )
  730.     {
  731.       point = rand_int(0,14);
  732.       
  733.       if ( point == 0 && ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) ) )
  734.       {
  735.         // Hop off 1
  736.         X = 26;
  737.         Y = 273;
  738.       }
  739.       else if ( point == 1 && ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) ) )
  740.       {
  741.         // Hop off 2
  742.         X = 68;
  743.         Y = 390;
  744.       }
  745.       else if ( point == 2 && ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) ) )
  746.       {
  747.         // Hop off 3
  748.         X = 388;
  749.         Y = 149;
  750.       }
  751.       else if ( point == 3 && ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) ) )
  752.       {
  753.         // Hop off 4
  754.         X = 382;
  755.         Y = 121;
  756.       }
  757.       else if ( point == 4 && ( ( find_city_owner( "Rzhev" ) == 5 ) || ( find_city_owner( "Rzhev" ) == 6 ) ) )
  758.       {
  759.         // Rzhev
  760.         X = 199;
  761.         Y = 343;
  762.       }
  763.       else if ( point == 5 && ( ( find_city_owner( "Gzhatsk" ) == 5 ) || ( find_city_owner( "Gzhatsk" ) == 6 ) ) )
  764.       {
  765.         // Gzhatsk
  766.         X = 232;
  767.         Y = 293;
  768.       }
  769.       else if ( point == 6 && ( ( find_city_owner( "Viazma" ) == 5 ) || ( find_city_owner( "Viazma" ) == 6 ) ) )
  770.       {
  771.         // Viazma
  772.         X = 282;
  773.         Y = 293;
  774.       }
  775.       else if ( point == 7 && ( ( find_city_owner( "Kalinin" ) == 5 ) || ( find_city_owner( "Kalinin" ) == 6 ) ) )
  776.       {
  777.         // Kalinin
  778.         X = 48;
  779.         Y = 258;
  780.       }
  781.       else if ( point == 8 && ( ( find_city_owner( "Volokolamsk" ) == 5 ) || ( find_city_owner( "Volokolamsk" ) == 6 ) ) )
  782.       {
  783.         // Volokolamsk
  784.         X = 99;
  785.         Y = 215;
  786.       }
  787.       else if ( point == 9 && ( ( find_city_owner( "Mozhaisk" ) == 5 ) || ( find_city_owner( "Mozhaisk" ) == 6 ) ) )
  788.       {
  789.         // Mozhaisk
  790.         X = 147;
  791.         Y = 158;
  792.       }
  793.       else if ( point == 10 && ( ( find_city_owner( "Kaluga" ) == 5 ) || ( find_city_owner( "Kaluga" ) == 6 ) ) )
  794.       {
  795.         // Kaluga
  796.         X = 224;
  797.         Y = 114;
  798.       }
  799.       else if ( point == 11 && ( ( find_city_owner( "Klin" ) == 5 ) || ( find_city_owner( "Klin" ) == 6 ) ) )
  800.       {
  801.         // Klin
  802.         X = 35;
  803.         Y = 186;
  804.       }
  805.       else if ( point == 12 && ( ( find_city_owner( "Istra" ) == 5 ) || ( find_city_owner( "Istra" ) == 6 ) ) )
  806.       {
  807.         // Istra
  808.         X = 88;
  809.         Y = 128;
  810.       }
  811.       else if ( point == 13 && ( ( find_city_owner( "Tula" ) == 5 ) || ( find_city_owner( "Tula" ) == 6 ) ) )
  812.       {
  813.         // Tula
  814.         X = 300;
  815.         Y = 61;
  816.       }
  817.     }
  818.     
  819.     // Get point of attack
  820.     // In a similar fashion, the attack will be directed in a 'slightly' less random direction
  821.     
  822.       if ( point == 0 )
  823.       {
  824.         // Hop off 1 to Kalinin
  825.         X2 = 48;
  826.         Y2 = 258;
  827.       }
  828.       else if ( point == 1 )
  829.       {
  830.         // Hop off 2 to Volokolamsk
  831.         X2 = 99;
  832.         Y2 = 215;
  833.       }
  834.       else if ( point == 2 )
  835.       {
  836.         // Hop off 3 to Kaluga
  837.         X2 = 224;
  838.         Y2 = 114;
  839.       }
  840.       else if ( point == 3 )
  841.       {
  842.         // Hop off 4 to Tula
  843.         X2 = 300;
  844.         Y2 = 61;
  845.       }
  846.       else if ( point == 4 )
  847.       {
  848.         // From Rzhev
  849.         
  850.         if ( ( find_city_owner( "Gzhatsk" ) != 5 ) && ( find_city_owner( "Gzhatsk" ) != 6 ) )
  851.         {
  852.           // Rzhev to Gzhatsk
  853.           X2 = 232;
  854.           Y2 = 293;
  855.         }
  856.         else if ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) )
  857.         {
  858.           // Rzhev to Kalinin
  859.           X2 = 48;
  860.           Y2 = 258;
  861.         }
  862.         else
  863.         {
  864.           // Go directly to Moscow, do not pass Gzhatsk
  865.           X2 = 27;
  866.           Y2 = 26;
  867.         }
  868.         
  869.       }
  870.       else if ( point == 5 )
  871.       {
  872.         // From Gzhatsk
  873.         
  874.         if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  875.         {
  876.           // Gzhatsk to Mozhaisk
  877.           X2 = 147;
  878.           Y2 = 158;
  879.         }
  880.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  881.         {
  882.           // Gzhatsk to Volokolamsk
  883.           X2 = 99;
  884.           Y2 = 215;
  885.         }
  886.         else if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  887.         {
  888.           // Gzhatsk to Kaluga
  889.           X2 = 224;
  890.           Y2 = 114;
  891.         }
  892.         else
  893.         {
  894.           // Go to Moscow
  895.           X2 = 27;
  896.           Y2 = 26;
  897.         }
  898.         
  899.       }
  900.       else if ( point == 6 )
  901.       {
  902.         // From Viazma
  903.         
  904.         if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  905.         {
  906.           // Viazma to Kaluga
  907.           X2 = 224;
  908.           Y2 = 114;
  909.         }
  910.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  911.         {
  912.           // Viazma to Mozhaisk
  913.           X2 = 147;
  914.           Y2 = 158;
  915.         }
  916.         else if ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) )
  917.         {
  918.           // Viazma to Tula
  919.           X2 = 300;
  920.           Y2 = 61;
  921.         }
  922.         else
  923.         {
  924.           // Go to Moscow
  925.           X2 = 27;
  926.           Y2 = 26;
  927.         }
  928.         
  929.       }
  930.       else if ( point == 7 )
  931.       {
  932.         // From Kalinin
  933.         
  934.         if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  935.         {
  936.           // Kalinin to Klin
  937.           X2 = 35;
  938.           Y2 = 186;
  939.         }
  940.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  941.         {
  942.           // Kalinin to Volokolamsk
  943.           X2 = 99;
  944.           Y2 = 215;
  945.         }
  946.         else
  947.         {
  948.           // Go to Moscow
  949.           X2 = 27;
  950.           Y2 = 26;
  951.         }
  952.         
  953.       }
  954.       else if ( point == 8 )
  955.       {
  956.         // From Volokolamsk
  957.         
  958.         if ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) )
  959.         {
  960.           // Volokolamsk to Kalinin
  961.           X2 = 48;
  962.           Y2 = 258;
  963.         }
  964.         else if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  965.         {
  966.           // Volokolamsk to Klin
  967.           X2 = 35;
  968.           Y2 = 186;
  969.         }
  970.         else if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  971.         {
  972.           // Volokolamsk to Istra
  973.           X2 = 88;
  974.           Y2 = 128;
  975.         }
  976.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  977.         {
  978.           // Volokolamsk to Mozhaisk
  979.           X2 = 147;
  980.           Y2 = 158;
  981.         }
  982.         else
  983.         {
  984.           // Go to Moscow
  985.           X2 = 27;
  986.           Y2 = 26;
  987.         }
  988.         
  989.       }
  990.       else if ( point == 9 )
  991.       {
  992.         // From Mozhaisk
  993.         
  994.         if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  995.         {
  996.           // Mozhaisk to Istra
  997.           X2 = 88;
  998.           Y2 = 128;
  999.         }
  1000.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  1001.         {
  1002.           // Mozhaisk to Volokolamsk
  1003.           X2 = 99;
  1004.           Y2 = 215;
  1005.         }
  1006.         else if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1007.         {
  1008.           // Mozhaisk to Kaluga
  1009.           X2 = 224;
  1010.           Y2 = 114;
  1011.         }
  1012.         else
  1013.         {
  1014.           // Go to Moscow
  1015.           X2 = 27;
  1016.           Y2 = 26;
  1017.         }
  1018.         
  1019.       }
  1020.       else if ( point == 10 )
  1021.       {
  1022.         // From Kaluga
  1023.         
  1024.         if ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) )
  1025.         {
  1026.           // Kaluga to Tula
  1027.           X2 = 300;
  1028.           Y2 = 61;
  1029.         }
  1030.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1031.         {
  1032.           // Kaluga to Mozhaisk
  1033.           X2 = 147;
  1034.           Y2 = 158;
  1035.         }
  1036.         else if ( ( find_city_owner( "Kashira" ) != 5 ) && ( find_city_owner( "Kashira" ) != 6 ) )
  1037.         {
  1038.           // Kaluga to Kashira
  1039.           X2 = 100;
  1040.           Y2 = 21;
  1041.         }
  1042.         else
  1043.         {
  1044.           // Go to Moscow
  1045.           X2 = 27;
  1046.           Y2 = 26;
  1047.         }
  1048.         
  1049.       }
  1050.       else if ( point == 11 )
  1051.       {
  1052.         // From Klin
  1053.         
  1054.         if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  1055.         {
  1056.           // Klin to Istra
  1057.           X2 = 88;
  1058.           Y2 = 128;
  1059.         }
  1060.         else
  1061.         {
  1062.           // Go to Moscow
  1063.           X2 = 27;
  1064.           Y2 = 26;
  1065.         }
  1066.         
  1067.       }
  1068.       else if ( point == 12 )
  1069.       {
  1070.         // From Istra
  1071.         
  1072.         if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  1073.         {
  1074.           // Istra to Klin
  1075.           X2 = 35;
  1076.           Y2 = 186;
  1077.         }
  1078.         else
  1079.         {
  1080.           // Go to Moscow
  1081.           X2 = 27;
  1082.           Y2 = 26;
  1083.         }
  1084.         
  1085.       }
  1086.       else if ( point == 13 )
  1087.       {
  1088.         // From Tula
  1089.         
  1090.         if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1091.         {
  1092.           // Tula to Kaluga
  1093.           X2 = 224;
  1094.           Y2 = 114;
  1095.         }
  1096.         else
  1097.         {
  1098.           // Go to Moscow
  1099.           X2 = 27;
  1100.           Y2 = 26;
  1101.         }
  1102.         
  1103.       }
  1104.       else
  1105.       {
  1106.         // Something odd happened, just go to Moscow and forget about it
  1107.           // Go to Moscow
  1108.           X2 = 27;
  1109.           Y2 = 26;
  1110.       }
  1111.     
  1112.     // Pick a team
  1113.     rand_seed( score ( 1 ) );
  1114.     spawn_who = rand_int(5,7);
  1115.     
  1116.     // Spawn Guys with Direction
  1117.     rand_seed( score ( 1 ) );
  1118.     spawn = rand_int(0,99);
  1119.     if ( ( 0 <= spawn ) && ( spawn < 49 ) )
  1120.     {
  1121.       // 50% Chance of scout group
  1122.       create_unit(spawn_who,X,Y,"Infantry",2);
  1123.       group_attack_to_order(spawn_who,X2,Y2);
  1124.       create_unit(spawn_who,X,Y,"Armored Scout Car",1);
  1125.       group_attack_to_order(spawn_who,X2,Y2);
  1126.     }
  1127.     else if ( ( 50 <= spawn ) && ( spawn < 74 ) )
  1128.     {
  1129.       // 25% Chance of medium assault
  1130.       create_unit(spawn_who,X,Y,"Infantry",3);
  1131.       group_attack_to_order(spawn_who,X2,Y2);
  1132.       create_unit(spawn_who,X,Y,"Tank",1);
  1133.       group_attack_to_order(spawn_who,X2,Y2);      
  1134.     }
  1135.     else if ( ( 75 <= spawn ) && ( spawn < 94 ) )
  1136.     {
  1137.       // 20% Chance of infantry assault
  1138.       create_unit(spawn_who,X,Y,"Infantry",3);
  1139.       group_attack_to_order(spawn_who,X2,Y2);
  1140.       create_unit(spawn_who,X,Y,"Heavy Machine Gun",1);
  1141.       group_attack_to_order(spawn_who,X2,Y2);
  1142.     }
  1143.     else
  1144.     {
  1145.       // 5% Chance of heavy assault
  1146.       create_unit(spawn_who,X,Y,"Infantry",5);
  1147.       group_attack_to_order(spawn_who,X2,Y2);
  1148.       create_unit(spawn_who,X,Y,"Tank",2);
  1149.       group_attack_to_order(spawn_who,X2,Y2); 
  1150.       create_unit(spawn_who,X,Y,"Howitzer",1);
  1151.       group_attack_to_order(spawn_who,X2,Y2);
  1152.     }
  1153.     
  1154.     // reset trigger and timer
  1155.     set_timer( "ra_one", 60 );
  1156.     enable_trigger( "random_attack_1" );
  1157.   }
  1158.   
  1159.   trigger random_attack_2 ( timer_expired( "ra_two" ) && !( is_defeated(5) || is_defeated(6) ) )
  1160.   {
  1161.     // reset variables
  1162.     X = 0;
  1163.     Y = 0;
  1164.     point = 0;
  1165.     spawn_who = 0;
  1166.     
  1167.     // Get spawn
  1168.     // This while loop wil continue looping until a spawn point has been set
  1169.     // It will only select cities if those cities are owned by the Germans
  1170.     rand_seed( score ( 1 ) );
  1171.     while ( ( X == 0 ) && ( Y == 0 ) )
  1172.     {
  1173.       point = rand_int(0,14);
  1174.       
  1175.       if ( point == 0 && ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) ) )
  1176.       {
  1177.         // Hop off 1
  1178.         X = 26;
  1179.         Y = 273;
  1180.       }
  1181.       else if ( point == 1 && ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) ) )
  1182.       {
  1183.         // Hop off 2
  1184.         X = 68;
  1185.         Y = 390;
  1186.       }
  1187.       else if ( point == 2 && ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) ) )
  1188.       {
  1189.         // Hop off 3
  1190.         X = 388;
  1191.         Y = 149;
  1192.       }
  1193.       else if ( point == 3 && ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) ) )
  1194.       {
  1195.         // Hop off 4
  1196.         X = 382;
  1197.         Y = 121;
  1198.       }
  1199.       else if ( point == 4 && ( ( find_city_owner( "Rzhev" ) == 5 ) || ( find_city_owner( "Rzhev" ) == 6 ) ) )
  1200.       {
  1201.         // Rzhev
  1202.         X = 199;
  1203.         Y = 343;
  1204.       }
  1205.       else if ( point == 5 && ( ( find_city_owner( "Gzhatsk" ) == 5 ) || ( find_city_owner( "Gzhatsk" ) == 6 ) ) )
  1206.       {
  1207.         // Gzhatsk
  1208.         X = 232;
  1209.         Y = 293;
  1210.       }
  1211.       else if ( point == 6 && ( ( find_city_owner( "Viazma" ) == 5 ) || ( find_city_owner( "Viazma" ) == 6 ) ) )
  1212.       {
  1213.         // Viazma
  1214.         X = 282;
  1215.         Y = 293;
  1216.       }
  1217.       else if ( point == 7 && ( ( find_city_owner( "Kalinin" ) == 5 ) || ( find_city_owner( "Kalinin" ) == 6 ) ) )
  1218.       {
  1219.         // Kalinin
  1220.         X = 48;
  1221.         Y = 258;
  1222.       }
  1223.       else if ( point == 8 && ( ( find_city_owner( "Volokolamsk" ) == 5 ) || ( find_city_owner( "Volokolamsk" ) == 6 ) ) )
  1224.       {
  1225.         // Volokolamsk
  1226.         X = 99;
  1227.         Y = 215;
  1228.       }
  1229.       else if ( point == 9 && ( ( find_city_owner( "Mozhaisk" ) == 5 ) || ( find_city_owner( "Mozhaisk" ) == 6 ) ) )
  1230.       {
  1231.         // Mozhaisk
  1232.         X = 147;
  1233.         Y = 158;
  1234.       }
  1235.       else if ( point == 10 && ( ( find_city_owner( "Kaluga" ) == 5 ) || ( find_city_owner( "Kaluga" ) == 6 ) ) )
  1236.       {
  1237.         // Kaluga
  1238.         X = 224;
  1239.         Y = 114;
  1240.       }
  1241.       else if ( point == 11 && ( ( find_city_owner( "Klin" ) == 5 ) || ( find_city_owner( "Klin" ) == 6 ) ) )
  1242.       {
  1243.         // Klin
  1244.         X = 35;
  1245.         Y = 186;
  1246.       }
  1247.       else if ( point == 12 && ( ( find_city_owner( "Istra" ) == 5 ) || ( find_city_owner( "Istra" ) == 6 ) ) )
  1248.       {
  1249.         // Istra
  1250.         X = 88;
  1251.         Y = 128;
  1252.       }
  1253.       else if ( point == 13 && ( ( find_city_owner( "Tula" ) == 5 ) || ( find_city_owner( "Tula" ) == 6 ) ) )
  1254.       {
  1255.         // Tula
  1256.         X = 300;
  1257.         Y = 61;
  1258.       }
  1259.     }
  1260.     
  1261.     // Get point of attack
  1262.     // In a similar fashion, the attack will be directed in a 'slightly' less random direction
  1263.     
  1264.       if ( point == 0 )
  1265.       {
  1266.         // Hop off 1 to Kalinin
  1267.         X2 = 48;
  1268.         Y2 = 258;
  1269.       }
  1270.       else if ( point == 1 )
  1271.       {
  1272.         // Hop off 2 to Volokolamsk
  1273.         X2 = 99;
  1274.         Y2 = 215;
  1275.       }
  1276.       else if ( point == 2 )
  1277.       {
  1278.         // Hop off 3 to Kaluga
  1279.         X2 = 224;
  1280.         Y2 = 114;
  1281.       }
  1282.       else if ( point == 3 )
  1283.       {
  1284.         // Hop off 4 to Tula
  1285.         X2 = 300;
  1286.         Y2 = 61;
  1287.       }
  1288.       else if ( point == 4 )
  1289.       {
  1290.         // From Rzhev
  1291.         
  1292.         if ( ( find_city_owner( "Gzhatsk" ) != 5 ) && ( find_city_owner( "Gzhatsk" ) != 6 ) )
  1293.         {
  1294.           // Rzhev to Gzhatsk
  1295.           X2 = 232;
  1296.           Y2 = 293;
  1297.         }
  1298.         else if ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) )
  1299.         {
  1300.           // Rzhev to Kalinin
  1301.           X2 = 48;
  1302.           Y2 = 258;
  1303.         }
  1304.         else
  1305.         {
  1306.           // Go directly to Moscow, do not pass Gzhatsk
  1307.           X2 = 27;
  1308.           Y2 = 26;
  1309.         }
  1310.         
  1311.       }
  1312.       else if ( point == 5 )
  1313.       {
  1314.         // From Gzhatsk
  1315.         
  1316.         if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1317.         {
  1318.           // Gzhatsk to Mozhaisk
  1319.           X2 = 147;
  1320.           Y2 = 158;
  1321.         }
  1322.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  1323.         {
  1324.           // Gzhatsk to Volokolamsk
  1325.           X2 = 99;
  1326.           Y2 = 215;
  1327.         }
  1328.         else if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1329.         {
  1330.           // Gzhatsk to Kaluga
  1331.           X2 = 224;
  1332.           Y2 = 114;
  1333.         }
  1334.         else
  1335.         {
  1336.           // Go to Moscow
  1337.           X2 = 27;
  1338.           Y2 = 26;
  1339.         }
  1340.         
  1341.       }
  1342.       else if ( point == 6 )
  1343.       {
  1344.         // From Viazma
  1345.         
  1346.         if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1347.         {
  1348.           // Viazma to Kaluga
  1349.           X2 = 224;
  1350.           Y2 = 114;
  1351.         }
  1352.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1353.         {
  1354.           // Viazma to Mozhaisk
  1355.           X2 = 147;
  1356.           Y2 = 158;
  1357.         }
  1358.         else if ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) )
  1359.         {
  1360.           // Viazma to Tula
  1361.           X2 = 300;
  1362.           Y2 = 61;
  1363.         }
  1364.         else
  1365.         {
  1366.           // Go to Moscow
  1367.           X2 = 27;
  1368.           Y2 = 26;
  1369.         }
  1370.         
  1371.       }
  1372.       else if ( point == 7 )
  1373.       {
  1374.         // From Kalinin
  1375.         
  1376.         if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  1377.         {
  1378.           // Kalinin to Klin
  1379.           X2 = 35;
  1380.           Y2 = 186;
  1381.         }
  1382.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  1383.         {
  1384.           // Kalinin to Volokolamsk
  1385.           X2 = 99;
  1386.           Y2 = 215;
  1387.         }
  1388.         else
  1389.         {
  1390.           // Go to Moscow
  1391.           X2 = 27;
  1392.           Y2 = 26;
  1393.         }
  1394.         
  1395.       }
  1396.       else if ( point == 8 )
  1397.       {
  1398.         // From Volokolamsk
  1399.         
  1400.         if ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) )
  1401.         {
  1402.           // Volokolamsk to Kalinin
  1403.           X2 = 48;
  1404.           Y2 = 258;
  1405.         }
  1406.         else if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  1407.         {
  1408.           // Volokolamsk to Klin
  1409.           X2 = 35;
  1410.           Y2 = 186;
  1411.         }
  1412.         else if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  1413.         {
  1414.           // Volokolamsk to Istra
  1415.           X2 = 88;
  1416.           Y2 = 128;
  1417.         }
  1418.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1419.         {
  1420.           // Volokolamsk to Mozhaisk
  1421.           X2 = 147;
  1422.           Y2 = 158;
  1423.         }
  1424.         else
  1425.         {
  1426.           // Go to Moscow
  1427.           X2 = 27;
  1428.           Y2 = 26;
  1429.         }
  1430.         
  1431.       }
  1432.       else if ( point == 9 )
  1433.       {
  1434.         // From Mozhaisk
  1435.         
  1436.         if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  1437.         {
  1438.           // Mozhaisk to Istra
  1439.           X2 = 88;
  1440.           Y2 = 128;
  1441.         }
  1442.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  1443.         {
  1444.           // Mozhaisk to Volokolamsk
  1445.           X2 = 99;
  1446.           Y2 = 215;
  1447.         }
  1448.         else if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1449.         {
  1450.           // Mozhaisk to Kaluga
  1451.           X2 = 224;
  1452.           Y2 = 114;
  1453.         }
  1454.         else
  1455.         {
  1456.           // Go to Moscow
  1457.           X2 = 27;
  1458.           Y2 = 26;
  1459.         }
  1460.         
  1461.       }
  1462.       else if ( point == 10 )
  1463.       {
  1464.         // From Kaluga
  1465.         
  1466.         if ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) )
  1467.         {
  1468.           // Kaluga to Tula
  1469.           X2 = 300;
  1470.           Y2 = 61;
  1471.         }
  1472.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1473.         {
  1474.           // Kaluga to Mozhaisk
  1475.           X2 = 147;
  1476.           Y2 = 158;
  1477.         }
  1478.         else if ( ( find_city_owner( "Kashira" ) != 5 ) && ( find_city_owner( "Kashira" ) != 6 ) )
  1479.         {
  1480.           // Kaluga to Kashira
  1481.           X2 = 100;
  1482.           Y2 = 21;
  1483.         }
  1484.         else
  1485.         {
  1486.           // Go to Moscow
  1487.           X2 = 27;
  1488.           Y2 = 26;
  1489.         }
  1490.         
  1491.       }
  1492.       else if ( point == 11 )
  1493.       {
  1494.         // From Klin
  1495.         
  1496.         if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  1497.         {
  1498.           // Klin to Istra
  1499.           X2 = 88;
  1500.           Y2 = 128;
  1501.         }
  1502.         else
  1503.         {
  1504.           // Go to Moscow
  1505.           X2 = 27;
  1506.           Y2 = 26;
  1507.         }
  1508.         
  1509.       }
  1510.       else if ( point == 12 )
  1511.       {
  1512.         // From Istra
  1513.         
  1514.         if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  1515.         {
  1516.           // Istra to Klin
  1517.           X2 = 35;
  1518.           Y2 = 186;
  1519.         }
  1520.         else
  1521.         {
  1522.           // Go to Moscow
  1523.           X2 = 27;
  1524.           Y2 = 26;
  1525.         }
  1526.         
  1527.       }
  1528.       else if ( point == 13 )
  1529.       {
  1530.         // From Tula
  1531.         
  1532.         if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1533.         {
  1534.           // Tula to Kaluga
  1535.           X2 = 224;
  1536.           Y2 = 114;
  1537.         }
  1538.         else
  1539.         {
  1540.           // Go to Moscow
  1541.           X2 = 27;
  1542.           Y2 = 26;
  1543.         }
  1544.         
  1545.       }
  1546.       else
  1547.       {
  1548.         // Something odd happened, just go to Moscow and forget about it
  1549.           // Go to Moscow
  1550.           X2 = 27;
  1551.           Y2 = 26;
  1552.       }
  1553.     
  1554.     // Pick a team
  1555.     rand_seed( score ( 1 ) );
  1556.     spawn_who = rand_int(5,7);
  1557.     
  1558.     // Spawn Guys with Direction
  1559.     rand_seed( score ( 1 ) );
  1560.     spawn = rand_int(0,99);
  1561.     if ( ( 0 <= spawn ) && ( spawn < 49 ) )
  1562.     {
  1563.       // 50% Chance of scout group
  1564.       create_unit(spawn_who,X,Y,"Infantry",2);
  1565.       group_attack_to_order(spawn_who,X2,Y2);
  1566.       create_unit(spawn_who,X,Y,"Armored Scout Car",1);
  1567.       group_attack_to_order(spawn_who,X2,Y2);
  1568.     }
  1569.     else if ( ( 50 <= spawn ) && ( spawn < 74 ) )
  1570.     {
  1571.       // 25% Chance of medium assault
  1572.       create_unit(spawn_who,X,Y,"Infantry",3);
  1573.       group_attack_to_order(spawn_who,X2,Y2);
  1574.       create_unit(spawn_who,X,Y,"Tank",1);
  1575.       group_attack_to_order(spawn_who,X2,Y2);      
  1576.     }
  1577.     else if ( ( 75 <= spawn ) && ( spawn < 94 ) )
  1578.     {
  1579.       // 20% Chance of infantry assault
  1580.       create_unit(spawn_who,X,Y,"Infantry",3);
  1581.       group_attack_to_order(spawn_who,X2,Y2);
  1582.       create_unit(spawn_who,X,Y,"Heavy Machine Gun",1);
  1583.       group_attack_to_order(spawn_who,X2,Y2);
  1584.     }
  1585.     else
  1586.     {
  1587.       // 5% Chance of heavy assault
  1588.       create_unit(spawn_who,X,Y,"Infantry",5);
  1589.       group_attack_to_order(spawn_who,X2,Y2);
  1590.       create_unit(spawn_who,X,Y,"Tank",2);
  1591.       group_attack_to_order(spawn_who,X2,Y2); 
  1592.       create_unit(spawn_who,X,Y,"Howitzer",1);
  1593.       group_attack_to_order(spawn_who,X2,Y2);
  1594.     }
  1595.     
  1596.     // reset trigger and timer
  1597.    
  1598.     set_timer( "ra_two", 60 );
  1599.     enable_trigger( "random_attack_2" );
  1600.   }
  1601.   
  1602.   trigger random_attack_3 ( timer_expired( "ra_three" ) && !( is_defeated(5) || is_defeated(6) ) )
  1603.   {
  1604.     // reset variables
  1605.     X = 0;
  1606.     Y = 0;
  1607.     point = 0;
  1608.     spawn_who = 0;
  1609.     
  1610.     // Get spawn
  1611.     // This while loop wil continue looping until a spawn point has been set
  1612.     // It will only select cities if those cities are owned by the Germans
  1613.     rand_seed( score ( 1 ) );
  1614.     while ( ( X == 0 ) && ( Y == 0 ) )
  1615.     {
  1616.       point = rand_int(0,14);
  1617.       
  1618.       if ( point == 0 && ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) ) )
  1619.       {
  1620.         // Hop off 1
  1621.         X = 26;
  1622.         Y = 273;
  1623.       }
  1624.       else if ( point == 1 && ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) ) )
  1625.       {
  1626.         // Hop off 2
  1627.         X = 68;
  1628.         Y = 390;
  1629.       }
  1630.       else if ( point == 2 && ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) ) )
  1631.       {
  1632.         // Hop off 3
  1633.         X = 388;
  1634.         Y = 149;
  1635.       }
  1636.       else if ( point == 3 && ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) ) )
  1637.       {
  1638.         // Hop off 4
  1639.         X = 382;
  1640.         Y = 121;
  1641.       }
  1642.       else if ( point == 4 && ( ( find_city_owner( "Rzhev" ) == 5 ) || ( find_city_owner( "Rzhev" ) == 6 ) ) )
  1643.       {
  1644.         // Rzhev
  1645.         X = 199;
  1646.         Y = 343;
  1647.       }
  1648.       else if ( point == 5 && ( ( find_city_owner( "Gzhatsk" ) == 5 ) || ( find_city_owner( "Gzhatsk" ) == 6 ) ) )
  1649.       {
  1650.         // Gzhatsk
  1651.         X = 232;
  1652.         Y = 293;
  1653.       }
  1654.       else if ( point == 6 && ( ( find_city_owner( "Viazma" ) == 5 ) || ( find_city_owner( "Viazma" ) == 6 ) ) )
  1655.       {
  1656.         // Viazma
  1657.         X = 282;
  1658.         Y = 293;
  1659.       }
  1660.       else if ( point == 7 && ( ( find_city_owner( "Kalinin" ) == 5 ) || ( find_city_owner( "Kalinin" ) == 6 ) ) )
  1661.       {
  1662.         // Kalinin
  1663.         X = 48;
  1664.         Y = 258;
  1665.       }
  1666.       else if ( point == 8 && ( ( find_city_owner( "Volokolamsk" ) == 5 ) || ( find_city_owner( "Volokolamsk" ) == 6 ) ) )
  1667.       {
  1668.         // Volokolamsk
  1669.         X = 99;
  1670.         Y = 215;
  1671.       }
  1672.       else if ( point == 9 && ( ( find_city_owner( "Mozhaisk" ) == 5 ) || ( find_city_owner( "Mozhaisk" ) == 6 ) ) )
  1673.       {
  1674.         // Mozhaisk
  1675.         X = 147;
  1676.         Y = 158;
  1677.       }
  1678.       else if ( point == 10 && ( ( find_city_owner( "Kaluga" ) == 5 ) || ( find_city_owner( "Kaluga" ) == 6 ) ) )
  1679.       {
  1680.         // Kaluga
  1681.         X = 224;
  1682.         Y = 114;
  1683.       }
  1684.       else if ( point == 11 && ( ( find_city_owner( "Klin" ) == 5 ) || ( find_city_owner( "Klin" ) == 6 ) ) )
  1685.       {
  1686.         // Klin
  1687.         X = 35;
  1688.         Y = 186;
  1689.       }
  1690.       else if ( point == 12 && ( ( find_city_owner( "Istra" ) == 5 ) || ( find_city_owner( "Istra" ) == 6 ) ) )
  1691.       {
  1692.         // Istra
  1693.         X = 88;
  1694.         Y = 128;
  1695.       }
  1696.       else if ( point == 13 && ( ( find_city_owner( "Tula" ) == 5 ) || ( find_city_owner( "Tula" ) == 6 ) ) )
  1697.       {
  1698.         // Tula
  1699.         X = 300;
  1700.         Y = 61;
  1701.       }
  1702.     }
  1703.     
  1704.     // Get point of attack
  1705.     // In a similar fashion, the attack will be directed in a 'slightly' less random direction
  1706.     
  1707.       if ( point == 0 )
  1708.       {
  1709.         // Hop off 1 to Kalinin
  1710.         X2 = 48;
  1711.         Y2 = 258;
  1712.       }
  1713.       else if ( point == 1 )
  1714.       {
  1715.         // Hop off 2 to Volokolamsk
  1716.         X2 = 99;
  1717.         Y2 = 215;
  1718.       }
  1719.       else if ( point == 2 )
  1720.       {
  1721.         // Hop off 3 to Kaluga
  1722.         X2 = 224;
  1723.         Y2 = 114;
  1724.       }
  1725.       else if ( point == 3 )
  1726.       {
  1727.         // Hop off 4 to Tula
  1728.         X2 = 300;
  1729.         Y2 = 61;
  1730.       }
  1731.       else if ( point == 4 )
  1732.       {
  1733.         // From Rzhev
  1734.         
  1735.         if ( ( find_city_owner( "Gzhatsk" ) != 5 ) && ( find_city_owner( "Gzhatsk" ) != 6 ) )
  1736.         {
  1737.           // Rzhev to Gzhatsk
  1738.           X2 = 232;
  1739.           Y2 = 293;
  1740.         }
  1741.         else if ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) )
  1742.         {
  1743.           // Rzhev to Kalinin
  1744.           X2 = 48;
  1745.           Y2 = 258;
  1746.         }
  1747.         else
  1748.         {
  1749.           // Go directly to Moscow, do not pass Gzhatsk
  1750.           X2 = 27;
  1751.           Y2 = 26;
  1752.         }
  1753.         
  1754.       }
  1755.       else if ( point == 5 )
  1756.       {
  1757.         // From Gzhatsk
  1758.         
  1759.         if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1760.         {
  1761.           // Gzhatsk to Mozhaisk
  1762.           X2 = 147;
  1763.           Y2 = 158;
  1764.         }
  1765.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  1766.         {
  1767.           // Gzhatsk to Volokolamsk
  1768.           X2 = 99;
  1769.           Y2 = 215;
  1770.         }
  1771.         else if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1772.         {
  1773.           // Gzhatsk to Kaluga
  1774.           X2 = 224;
  1775.           Y2 = 114;
  1776.         }
  1777.         else
  1778.         {
  1779.           // Go to Moscow
  1780.           X2 = 27;
  1781.           Y2 = 26;
  1782.         }
  1783.         
  1784.       }
  1785.       else if ( point == 6 )
  1786.       {
  1787.         // From Viazma
  1788.         
  1789.         if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1790.         {
  1791.           // Viazma to Kaluga
  1792.           X2 = 224;
  1793.           Y2 = 114;
  1794.         }
  1795.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1796.         {
  1797.           // Viazma to Mozhaisk
  1798.           X2 = 147;
  1799.           Y2 = 158;
  1800.         }
  1801.         else if ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) )
  1802.         {
  1803.           // Viazma to Tula
  1804.           X2 = 300;
  1805.           Y2 = 61;
  1806.         }
  1807.         else
  1808.         {
  1809.           // Go to Moscow
  1810.           X2 = 27;
  1811.           Y2 = 26;
  1812.         }
  1813.         
  1814.       }
  1815.       else if ( point == 7 )
  1816.       {
  1817.         // From Kalinin
  1818.         
  1819.         if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  1820.         {
  1821.           // Kalinin to Klin
  1822.           X2 = 35;
  1823.           Y2 = 186;
  1824.         }
  1825.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  1826.         {
  1827.           // Kalinin to Volokolamsk
  1828.           X2 = 99;
  1829.           Y2 = 215;
  1830.         }
  1831.         else
  1832.         {
  1833.           // Go to Moscow
  1834.           X2 = 27;
  1835.           Y2 = 26;
  1836.         }
  1837.         
  1838.       }
  1839.       else if ( point == 8 )
  1840.       {
  1841.         // From Volokolamsk
  1842.         
  1843.         if ( ( find_city_owner( "Kalinin" ) != 5 ) && ( find_city_owner( "Kalinin" ) != 6 ) )
  1844.         {
  1845.           // Volokolamsk to Kalinin
  1846.           X2 = 48;
  1847.           Y2 = 258;
  1848.         }
  1849.         else if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  1850.         {
  1851.           // Volokolamsk to Klin
  1852.           X2 = 35;
  1853.           Y2 = 186;
  1854.         }
  1855.         else if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  1856.         {
  1857.           // Volokolamsk to Istra
  1858.           X2 = 88;
  1859.           Y2 = 128;
  1860.         }
  1861.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1862.         {
  1863.           // Volokolamsk to Mozhaisk
  1864.           X2 = 147;
  1865.           Y2 = 158;
  1866.         }
  1867.         else
  1868.         {
  1869.           // Go to Moscow
  1870.           X2 = 27;
  1871.           Y2 = 26;
  1872.         }
  1873.         
  1874.       }
  1875.       else if ( point == 9 )
  1876.       {
  1877.         // From Mozhaisk
  1878.         
  1879.         if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  1880.         {
  1881.           // Mozhaisk to Istra
  1882.           X2 = 88;
  1883.           Y2 = 128;
  1884.         }
  1885.         else if ( ( find_city_owner( "Volokolamsk" ) != 5 ) && ( find_city_owner( "Volokolamsk" ) != 6 ) )
  1886.         {
  1887.           // Mozhaisk to Volokolamsk
  1888.           X2 = 99;
  1889.           Y2 = 215;
  1890.         }
  1891.         else if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1892.         {
  1893.           // Mozhaisk to Kaluga
  1894.           X2 = 224;
  1895.           Y2 = 114;
  1896.         }
  1897.         else
  1898.         {
  1899.           // Go to Moscow
  1900.           X2 = 27;
  1901.           Y2 = 26;
  1902.         }
  1903.         
  1904.       }
  1905.       else if ( point == 10 )
  1906.       {
  1907.         // From Kaluga
  1908.         
  1909.         if ( ( find_city_owner( "Tula" ) != 5 ) && ( find_city_owner( "Tula" ) != 6 ) )
  1910.         {
  1911.           // Kaluga to Tula
  1912.           X2 = 300;
  1913.           Y2 = 61;
  1914.         }
  1915.         else if ( ( find_city_owner( "Mozhaisk" ) != 5 ) && ( find_city_owner( "Mozhaisk" ) != 6 ) )
  1916.         {
  1917.           // Kaluga to Mozhaisk
  1918.           X2 = 147;
  1919.           Y2 = 158;
  1920.         }
  1921.         else if ( ( find_city_owner( "Kashira" ) != 5 ) && ( find_city_owner( "Kashira" ) != 6 ) )
  1922.         {
  1923.           // Kaluga to Kashira
  1924.           X2 = 100;
  1925.           Y2 = 21;
  1926.         }
  1927.         else
  1928.         {
  1929.           // Go to Moscow
  1930.           X2 = 27;
  1931.           Y2 = 26;
  1932.         }
  1933.         
  1934.       }
  1935.       else if ( point == 11 )
  1936.       {
  1937.         // From Klin
  1938.         
  1939.         if ( ( find_city_owner( "Istra" ) != 5 ) && ( find_city_owner( "Istra" ) != 6 ) )
  1940.         {
  1941.           // Klin to Istra
  1942.           X2 = 88;
  1943.           Y2 = 128;
  1944.         }
  1945.         else
  1946.         {
  1947.           // Go to Moscow
  1948.           X2 = 27;
  1949.           Y2 = 26;
  1950.         }
  1951.         
  1952.       }
  1953.       else if ( point == 12 )
  1954.       {
  1955.         // From Istra
  1956.         
  1957.         if ( ( find_city_owner( "Klin" ) != 5 ) && ( find_city_owner( "Klin" ) != 6 ) )
  1958.         {
  1959.           // Istra to Klin
  1960.           X2 = 35;
  1961.           Y2 = 186;
  1962.         }
  1963.         else
  1964.         {
  1965.           // Go to Moscow
  1966.           X2 = 27;
  1967.           Y2 = 26;
  1968.         }
  1969.         
  1970.       }
  1971.       else if ( point == 13 )
  1972.       {
  1973.         // From Tula
  1974.         
  1975.         if ( ( find_city_owner( "Kaluga" ) != 5 ) && ( find_city_owner( "Kaluga" ) != 6 ) )
  1976.         {
  1977.           // Tula to Kaluga
  1978.           X2 = 224;
  1979.           Y2 = 114;
  1980.         }
  1981.         else
  1982.         {
  1983.           // Go to Moscow
  1984.           X2 = 27;
  1985.           Y2 = 26;
  1986.         }
  1987.         
  1988.       }
  1989.       else
  1990.       {
  1991.         // Something odd happened, just go to Moscow and forget about it
  1992.           // Go to Moscow
  1993.           X2 = 27;
  1994.           Y2 = 26;
  1995.       }
  1996.     
  1997.     // Pick a team
  1998.     rand_seed( score ( 1 ) );
  1999.     spawn_who = rand_int(5,7);
  2000.     
  2001.     // Spawn Guys with Direction
  2002.     rand_seed( score ( 1 ) );
  2003.     spawn = rand_int(0,99);
  2004.     if ( ( 0 <= spawn ) && ( spawn < 49 ) )
  2005.     {
  2006.       // 50% Chance of scout group
  2007.       create_unit(spawn_who,X,Y,"Infantry",2);
  2008.       group_attack_to_order(spawn_who,X2,Y2);
  2009.       create_unit(spawn_who,X,Y,"Armored Scout Car",1);
  2010.       group_attack_to_order(spawn_who,X2,Y2);
  2011.     }
  2012.     else if ( ( 50 <= spawn ) && ( spawn < 74 ) )
  2013.     {
  2014.       // 25% Chance of medium assault
  2015.       create_unit(spawn_who,X,Y,"Infantry",3);
  2016.       group_attack_to_order(spawn_who,X2,Y2);
  2017.       create_unit(spawn_who,X,Y,"Tank",1);
  2018.       group_attack_to_order(spawn_who,X2,Y2);      
  2019.     }
  2020.     else if ( ( 75 <= spawn ) && ( spawn < 94 ) )
  2021.     {
  2022.       // 20% Chance of infantry assault
  2023.       create_unit(spawn_who,X,Y,"Infantry",3);
  2024.       group_attack_to_order(spawn_who,X2,Y2);
  2025.       create_unit(spawn_who,X,Y,"Heavy Machine Gun",1);
  2026.       group_attack_to_order(spawn_who,X2,Y2);
  2027.     }
  2028.     else
  2029.     {
  2030.       // 5% Chance of heavy assault
  2031.       create_unit(spawn_who,X,Y,"Infantry",5);
  2032.       group_attack_to_order(spawn_who,X2,Y2);
  2033.       create_unit(spawn_who,X,Y,"Tank",2);
  2034.       group_attack_to_order(spawn_who,X2,Y2); 
  2035.       create_unit(spawn_who,X,Y,"Howitzer",1);
  2036.       group_attack_to_order(spawn_who,X2,Y2);
  2037.     }
  2038.     
  2039.     // reset trigger and timer
  2040.     
  2041.     set_timer( "ra_three", 60 );
  2042.     enable_trigger( "random_attack_3" );
  2043.   }
  2044.   
  2045.   trigger kamikaze ( )
  2046.   {
  2047.     rallyID = 0;
  2048.   
  2049.     for ( int q = 5; q < 7; q++ )
  2050.     {
  2051.       for ( int r = 0; r < num_military_units( q ); r++ )
  2052.       {
  2053.         rallyID = find_military( q );
  2054.         unit_attack_to_order( q, rallyID, X, Y); // This will go to whatever the last X, Y point was
  2055.       }
  2056.     } 
  2057.   }
  2058.   
  2059.   trigger i_r_winner ( is_defeated( 5 ) || is_defeated( 6 ) )
  2060.   {
  2061.     objective_complete( "offensive" );
  2062.     popup_dialog( "Well done general.  Comrade Stalin has requested you for a tribute in your honor.  Congratulations is in order general, as you have saved the Soviet Union from the brink and have driven the Fascists from the capital.  However, more is yet to come general..." );
  2063.     popup_dialog( "You are now ready for the fifth part of this campaign.  Please load the next scenario in the Red Front sequence." );
  2064.     victory( 1 );
  2065.   }
  2066.   
  2067.  
  2068. // end of script